Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add autoNetworkTier to Router NAT #9379

Merged

Conversation

maxi-cit
Copy link
Contributor

@maxi-cit maxi-cit commented Oct 30, 2023

Fixes: hashicorp/terraform-provider-google#16139

It adds support to set the network tier to use when automatically reserving NAT IP Addresses

If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Generated Terraform providers, and ran make test and make lint in the generated providers to ensure it passes unit and linter tests.
  • Ran relevant acceptance tests using my own Google Cloud project and credentials (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read Write release notes before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

compute: added `auto_network_tier` field to `google_compute_router_nat` resource

@modular-magician
Copy link
Collaborator

Hello! I am a robot. It looks like you are a: Community Contributor Googler Core Contributor. Tests will require approval to run.

@trodge, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

@modular-magician modular-magician added awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests labels Oct 30, 2023
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 2 files changed, 38 insertions(+))
Terraform Beta: Diff ( 2 files changed, 38 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_router_nat (11 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_router_nat" "primary" {
  auto_network_tier = # value needed
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3184
Passed tests 2855
Skipped tests: 325
Affected tests: 4

Action taken

Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeRouterNat_update|TestAccComputeRouterNat_basic|TestAccComputeRouterNat_removeLogConfig|TestAccDataSourceGoogleComputeRouterNat_basic

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccComputeRouterNat_update[Error message] [Debug log]
TestAccComputeRouterNat_basic[Error message] [Debug log]
TestAccComputeRouterNat_removeLogConfig[Error message] [Debug log]
TestAccDataSourceGoogleComputeRouterNat_basic[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

Copy link
Contributor

@trodge trodge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need some way to handle the values the API returns for this field for existing resources.

The field value is derived from a setting on the project that the resource belongs to, so one option would be to try to look up that value and set it in an encoder when it's unspecified. However, I don't know of an easy way to get that information.

The alternative would be to use default_from_api: true on this field, but that would mean that deleting this field from the configuration would preserve whatever the last value was even if the project-level default changed.

@maxi-cit
Copy link
Contributor Author

maxi-cit commented Nov 7, 2023

Hello @trodge, I have been studying the first case and I think is somewhat doable.
However, could you explain about the latter case, please?

@modular-magician modular-magician added awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests service/compute-nat and removed awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests labels Nov 13, 2023
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 2 files changed, 38 insertions(+))
Terraform Beta: Diff ( 2 files changed, 38 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_router_nat (11 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_router_nat" "primary" {
  auto_network_tier = # value needed
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3235
Passed tests 2901
Skipped tests: 330
Affected tests: 4

Action taken

Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeRouterNat_update|TestAccComputeRouterNat_removeLogConfig|TestAccComputeRouterNat_basic|TestAccDataSourceGoogleComputeRouterNat_basic

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccComputeRouterNat_update[Error message] [Debug log]
TestAccComputeRouterNat_removeLogConfig[Error message] [Debug log]
TestAccComputeRouterNat_basic[Error message] [Debug log]
TestAccDataSourceGoogleComputeRouterNat_basic[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@trodge
Copy link
Contributor

trodge commented Dec 1, 2023

Hello @trodge, I have been studying the first case and I think is somewhat doable. However, could you explain about the latter case, please?

Setting default_from_api will make the field Optional and Computed in the provider, which means that any value returned from the API will be treated as though it matches an empty value in the user's config.

@modular-magician modular-magician added the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Jan 23, 2024
@maxi-cit
Copy link
Contributor Author

Helllo @trodge I tried to implement your encoder fix so it will take the project default when empty. Could you take a look, please?

@modular-magician modular-magician removed the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Feb 16, 2024
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 2 files changed, 69 insertions(+))
Terraform Beta: Diff ( 3 files changed, 112 insertions(+), 5 deletions(-))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_router_nat (17 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_router_nat" "primary" {
  auto_network_tier = # value needed
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 887
Passed tests 802
Skipped tests: 72
Affected tests: 13

Click here to see the affected service packages
  • compute

Action taken

Found 13 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeRouterNat_withPrivateNat|TestAccComputeRouterNat_AutoNetworkTier|TestAccComputeRouterNat_withManualIpAndSubnetConfiguration|TestAccComputeRouterNat_withNatRules|TestAccComputeRouterNat_withPortAllocationMethods|TestAccComputeRouterNat_withNatIpsAndDrainNatIps|TestAccDataSourceGoogleComputeRouterNat_basic|TestAccComputeRouterNat_withPrivateNatAndEmptyActionActiveRanges|TestAccComputeRouterNat_update|TestAccComputeRouterNat_removeLogConfig|TestAccComputeRouterNat_withPrivateNatAndEmptyAction|TestAccComputeRouterNat_basic|TestAccComputeRouterNat_withPrivateNatAndRules

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccComputeRouterNat_withPrivateNat[Debug log]
TestAccComputeRouterNat_withManualIpAndSubnetConfiguration[Debug log]
TestAccComputeRouterNat_withNatRules[Debug log]
TestAccComputeRouterNat_withPortAllocationMethods[Debug log]
TestAccComputeRouterNat_withNatIpsAndDrainNatIps[Debug log]
TestAccComputeRouterNat_withPrivateNatAndRules[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccComputeRouterNat_AutoNetworkTier[Error message] [Debug log]
TestAccDataSourceGoogleComputeRouterNat_basic[Error message] [Debug log]
TestAccComputeRouterNat_withPrivateNatAndEmptyActionActiveRanges[Error message] [Debug log]
TestAccComputeRouterNat_update[Error message] [Debug log]
TestAccComputeRouterNat_removeLogConfig[Error message] [Debug log]
TestAccComputeRouterNat_withPrivateNatAndEmptyAction[Error message] [Debug log]
TestAccComputeRouterNat_basic[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@modular-magician modular-magician removed the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Apr 23, 2024
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 3 files changed, 80 insertions(+))
google-beta provider: Diff ( 3 files changed, 85 insertions(+), 5 deletions(-))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_router_nat (21 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_router_nat" "primary" {
  auto_network_tier = # value needed
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 900
Passed tests: 820
Skipped tests: 72
Affected tests: 8

Click here to see the affected service packages
  • compute

Action taken

Found 8 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeRegionPerInstanceConfig_removeInstanceOnDestroy|TestAccComputeRouterNat_AutoNetworkTier|TestAccComputeRouterNat_withManualIpAndSubnetConfiguration|TestAccComputeRouterNat_withNatIpsAndDrainNatIps|TestAccComputeRouterNat_withNatRules|TestAccComputeRouterNat_withPortAllocationMethods|TestAccComputeRouterNat_withPrivateNat|TestAccComputeRouterNat_withPrivateNatAndRules

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccComputeRegionPerInstanceConfig_removeInstanceOnDestroy[Debug log]
TestAccComputeRouterNat_AutoNetworkTier[Debug log]
TestAccComputeRouterNat_withManualIpAndSubnetConfiguration[Debug log]
TestAccComputeRouterNat_withNatIpsAndDrainNatIps[Debug log]
TestAccComputeRouterNat_withNatRules[Debug log]
TestAccComputeRouterNat_withPortAllocationMethods[Debug log]
TestAccComputeRouterNat_withPrivateNat[Debug log]
TestAccComputeRouterNat_withPrivateNatAndRules[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$
View the build log or the debug log for each test

@trodge
Copy link
Contributor

trodge commented May 7, 2024

/gcbrun

@modular-magician modular-magician added awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests labels May 7, 2024
Copy link
Contributor

@trodge trodge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like testAccComputeRouterNatBaseResourcesWithPrivateNatSubnetworks was moved inside <% unless version == "ga" -%> guards, making it beta only. To get this to compile you'll need to move that function outside the beta-only guard.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 3 files changed, 80 insertions(+))
google-beta provider: Diff ( 3 files changed, 85 insertions(+), 5 deletions(-))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_router_nat (21 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_router_nat" "primary" {
  auto_network_tier = # value needed
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 907
Passed tests: 834
Skipped tests: 72
Affected tests: 1

Click here to see the affected service packages
  • compute

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeRegionPerInstanceConfig_removeInstanceOnDestroy

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccComputeRegionPerInstanceConfig_removeInstanceOnDestroy[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$
View the build log or the debug log for each test

@github-actions github-actions bot requested a review from trodge May 8, 2024 15:30
@modular-magician modular-magician added the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label May 8, 2024
@maxi-cit
Copy link
Contributor Author

maxi-cit commented May 8, 2024

Hello @trodge thanks for the feedback. I applied your suggestions and moved the function. This should be fixing it, but if fails on the ga-provider I will make a separate one

@modular-magician modular-magician removed the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label May 8, 2024
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 3 files changed, 148 insertions(+))
google-beta provider: Diff ( 3 files changed, 122 insertions(+), 42 deletions(-))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_router_nat (21 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_router_nat" "primary" {
  auto_network_tier = # value needed
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 914
Passed tests: 842
Skipped tests: 72
Affected tests: 0

Click here to see the affected service packages
  • compute

$\textcolor{green}{\textsf{All tests passed!}}$
View the build log

@trodge trodge merged commit f8831fb into GoogleCloudPlatform:main May 8, 2024
14 checks passed
kautikdk pushed a commit to kautikdk/magic-modules that referenced this pull request May 16, 2024
pawelJas pushed a commit to pawelJas/magic-modules that referenced this pull request May 16, 2024
pengq-google pushed a commit to pengq-google/magic-modules that referenced this pull request May 21, 2024
Cheriit pushed a commit to Cheriit/magic-modules that referenced this pull request Jun 4, 2024
pcostell pushed a commit to pcostell/magic-modules that referenced this pull request Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for field “autoNetworkTier” in CloudNat resource
4 participants